package com.hzlj.position.locate.common.enums;

import com.fz.common.base.exception.PubError;
import com.fz.common.base.exception.PubException;
import lombok.Getter;

/**
 * @author lifh
 * @date 2021/11/9 上午11:59
 **/
@Getter
public enum VideoStatus {
    /**
     * 0 call：拨打
     * 1 answer：接听
     * 2 reject：拒接
     * 3 hangup：挂断
     */
    CALL("0", "拨打"),
    ANSWER("1", "接听"),
    REJECT("2", "拒接"),
    HANGUP("3", "挂断"),
    ;

    private final String status;
    private final String statusText;

    VideoStatus(String status, String statusText) {
        this.status = status;
        this.statusText = statusText;
    }

    public static VideoStatus of(String status) {
        for (VideoStatus statusEnum : values()) {
            if (statusEnum.status.equalsIgnoreCase(status)) {
                return statusEnum;
            }
        }
        throw new PubException(PubError.PARAM_EMPTY_ERROR);
    }
}
